/*
 * @Author: 杨光辉(GerhardYang)
 * @Date: 2020-12-14 13:09:24
 * @LastEditors: 杨光辉(GerhardYang)
 * @LastEditTime: 2021-06-04 12:15:10
 * @Description: file content
 * @Copyright: 超图软件华中平台客户中心 (SuperMap Software Co., Ltd. -Central China Platform)
 */

/**
 * @description:
 * @param {feature, type, isLogin,}
 * @return {html}
 */

import localStorage from "@/utils/localStorage";
const SearchLayersPopuplink = JSON.parse(
  localStorage.get("SearchLayersPopuplink")
);

export default (feature, Param, btnId) => {
  let content1;
  let content2;
  let content3;

  // </span><button class="ant-btn ant-btn-link"  onclick="${ btnId }Detail()">详情</bttton>
  content1 = `<div class="popup-content">
                        <div>
                            <span>名称：${
                              feature._source[Param.esName]
                            }</span><br>
                            <span>地址：${
                              feature._source[Param.esAddress]
                            }</span><br>
                            <span>类别：${Param.title}</span><br>
                            <span>经纬度：${feature._source.location.lat.toFixed(
                              3
                            )},${feature._source.location.lon.toFixed(3)}
                        </div>`;

  content2 = `<div>
                    <span>从附近搜索：</span><input  type="text" id="poi-search-input" class="ant-input ant-input-sm" style="width:150px" placeholder="类型名称 分类名称"/>
                    <select id ="poi-search-select" class="ant-input ant-input-sm" style="width:86px">
                        <option value ="1000">1公里</option>
                        <option value ="2000">2公里</option>
                        <option value="5000">5公里</option>
                        <option value="10000">10公里</option>
                    </select>
                    <button id="poi-search-btn" class="ant-btn ant-btn-primary ant-btn-sm" onclick="${btnId}Search()">搜索</bttton>
                    </div>
                    <br>
                    <div>`;
  for (let item of SearchLayersPopuplink) {
    content2 += ` <span>${item.title}:&nbsp;</span>`;
    let nodes = item.nodes.split(/[\n,]/g);
    for (let node of nodes) {
      content2 += `<a href="javascript:void(0)" class="poipopuplink" es-title=${item.title}>${node}</a>&nbsp;&nbsp;`;
    }
    content2 += `<br>`;
  }

  content3 = `</div>
          </div>`;

  return content1 + content2 + content3;
};
